Skip to content

fix(strix): isolate direct-OpenAI fallback from foreign ambient API base - #1323

Closed
seonghobae wants to merge 1 commit into
mainfrom
fix/strix-openai-fallback-base-isolation
Closed

fix(strix): isolate direct-OpenAI fallback from foreign ambient API base#1323
seonghobae wants to merge 1 commit into
mainfrom
fix/strix-openai-fallback-base-isolation

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Problem

Every Orgmetra Strix scan in nvidia_nim mode that exhausted NIM retries (shared org key → 429 storms) then hit the contracted final fallback openai-direct/gpt-5.6-luna and failed with a literal 404 page not found. Evidence: Orgmetra strix run 32782227098 attempt 2 — primary nemotron-3-super-120b-a12b RateLimitError ×3, fallback llama-3.3-nemotron-super-49b-v1.5 failure signal, fallback openai-direct/gpt-5.4/5.6-luna LLM CONNECTION FAILED (404), gate fail-closed with zero report artifacts.

Root cause

resolved_llm_api_base_for_model only overrides the API base for GitHub Models models. Explicit direct-OpenAI fallbacks fell through to the ambient LLM_API_BASE_FILE, which in nvidia_nim/openrouter modes points at the primary provider's gateway. run_strix_once correctly swaps in STRIX_OPENAI_FALLBACK_KEY but posts to the NVIDIA/OpenRouter gateway anyway → Go-style 404 page not found.

Fix

Early return (empty base) for openai_direct/* | openai-direct/* so litellm uses its default https://api.openai.com/v1, identical to how direct-OpenAI primaries already route. Key swap at line 2549 is unchanged; no secret or review-agent key scheme touched.

RED→GREEN evidence

New function-execution regression contract tests/test_strix_openai_fallback_base_isolation.py:

  • openai-direct + NVIDIA ambient base → empty base (RED before patch: returned NVIDIA gateway)
  • openai_direct spelling → same isolation
  • non-OpenAI model → still inherits ambient NVIDIA base
  • github_models fallback → still uses dedicated models.github.ai base

Existing gate contracts pass locally: nim-not-found, backend-unavailable-after-exempted-finding, model-behavior-error suites (28 tests OK).

Scope

Orgmetra-facing Strix lane only; no review-agent credential changes.


Open in Devin Review

In nvidia_nim or openrouter modes the contracted final openai-direct
fallback inherited LLM_API_BASE pointing at the primary provider's
gateway; that gateway answers an OpenAI-keyed request with a literal
'404 page not found', so NIM rate-limit storms always exhausted every
fallback and failed closed. resolved_llm_api_base_for_model now returns
an empty base for explicit direct-OpenAI models, letting litellm use its
default api.openai.com endpoint exactly like direct primaries, while
GitHub Models and same-provider fallback routing is unchanged.

RED->GREEN covered by a function-execution regression contract pinning:
openai-direct/openai_direct isolation under an NVIDIA ambient base,
unchanged NVIDIA-base inheritance for non-OpenAI models, and unchanged
dedicated-base routing for GitHub Models fallbacks.
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 11 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2fb308e6-17a1-4429-b693-df9c98da27fc

📥 Commits

Reviewing files that changed from the base of the PR and between 8fd471a and d515f9b.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • scripts/ci/strix_quick_gate.sh
  • tests/test_strix_openai_fallback_base_isolation.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Open in Devin Review

Comment on lines +2418 to +2428
if is_explicit_openai_model "$model"; then
# Cross-provider fallback: an explicit direct-OpenAI model must never
# inherit another provider's ambient API base. In nvidia_nim or
# openrouter modes LLM_API_BASE_FILE points at that provider's gateway,
# which answers an OpenAI-keyed chat request with a literal
# "404 page not found". Returning empty lets litellm use its default
# https://api.openai.com/v1 endpoint, exactly like openai_direct
# primaries, while run_strix_once already swaps in the dedicated
# STRIX_OPENAI_FALLBACK_KEY for authentication.
return 0
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Ambient base now ignored for direct-OpenAI even as primary

The early return in resolved_llm_api_base_for_model fires for any openai_direct/* or openai-direct/* model, not only fallbacks. A direct-OpenAI model configured as the STRIX_LLM primary with a custom LLM_API_BASE (e.g. an OpenAI-compatible proxy) would now have that base silently discarded and default to api.openai.com. Current org configs use openai_direct only as a fallback, so no live caller is affected.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Superseded by replacement PR #1331, which re-uploaded the direct-OpenAI fallback API-base fix on current main.

@seonghobae seonghobae closed this Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant